﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections.Generic;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using MenuBar = Microserve.TeleEye.Common.MenuBar;
using System.Text;

namespace Microserve.TeleEye.Web.Utility
{
    public static class MenuFactory
    {
        public static string GenerateMenu(List<MenuBar.MenuItem> sidebarMenus)
        {
            StringBuilder toolBox = new StringBuilder();

            foreach (MenuBar.MenuItem sidebarMenu in sidebarMenus)
            {
                toolBox.Append(@"<div id=""toolbox1"" class=""toolbox"">");
                toolBox.Append(@"<div class=""titlebar"">");
                toolBox.Append(@"<img src=""static/img/expanded.gif"" class=""expander"" />");
                toolBox.Append(sidebarMenu.Title);
                toolBox.Append("</div>");

                foreach (MenuBar.MenuItem sidebarSubMenu in sidebarMenu.SubMenu)
                {
                    toolBox.Append(@"<a href=""" + sidebarSubMenu.NavigateUrl + @""">" + sidebarSubMenu.Title + "</a>");
                }

                toolBox.Append("</div>");
            }

            return toolBox.ToString();
        }
    }
}
